# ![](https://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/static/img/logo.png?raw=true)


0. ## Installation script

```bash
cd ctfd-owhale/
chmod +x ./autoexec.sh
./autoexec.sh
```


1. ### preinstallation

   ```bash
   curl -fsSL https://get.docker.com -o get-docker.sh
   sh get-docker.sh
   mv ctfd-owhale/ CTFd/
   ```
   

2. ### install frps

   ##### download frps

   ```bash
   cd
   wget https://github.com/fatedier/frp/releases/download/v0.56.0/frp_0.56.0_linux_amd64.tar.gz
   tar -zxvf frp_0.56.0_linux_amd64.tar.gz
   cd frp_0.56.0_linux_amd64
   sudo mkdir /etc/frp
   sudo cp frpc.toml frps.toml /etc/frp/
   sudo cp frpc frps /usr/bin/
   sudo chmod a+x /usr/bin/frpc /usr/bin/frps
   ```

   ##### set frps.toml config 
   ```bash
   sudo micro /etc/frp/frps.toml
   ```

   ```toml
   bindAddr = "0.0.0.0"
   bindPort = 7897
   auth.method = "token"
   auth.token = "token"
   vhostHTTPPort = 8080
   subDomainHost = "inssurg3nt.ru"
   log.to = "./frps.log"
   log.level = "info"
   ```
   
   ##### create frps service 
   ```bash
   sudo micro /etc/systemd/system/CTFd-Frps.service
   ```
   
   ```yaml
   # /etc/systemd/system/CTFd-Frps.service
   [Unit]
   Description=CTFd Dedicated Frp Server
   After=network.target
   
   [Service]
   Type=simple
   User=nobody
   Restart=on-failure
   RestartSec=5s
   ExecStart=/usr/bin/frps -c /etc/frp/frps.toml
   
   [Install]
   WantedBy=multi-user.target
   ```
   ##### restart frps

   ```bash
   sudo systemctl enable CTFd-Frps
   sudo systemctl start CTFd-Frps
   ```

3. ### docker network

   ```bash
   cd ~/CTFd/
   docker swarm init
   docker node update --label-add "name=linux-1" $(docker node ls -q)
   ```

4. ### frpc(client)

   ```bash
   micro ./conf/frp/frpc.ini
   ```

   ```ini
   [common]
   token="token"
   server_addr = "172.17.0.1"
   server_port = 7897
   admin_addr = "172.1.0.4"
   admin_port = 7400
   ```

   ```bash
   micro ./conf/compose-frp/frpc.ini
   ```

   ```ini
   [common]
   token="token"
   server_addr = "172.17.0.1"
   server_port = 7897
   admin_addr = "172.1.0.5"
   admin_port = 7400

   ```
5. ### docker-compose up -d

   ```bash
   chmod +x docker-entrypoint.sh
   sudo docker compose build
   sudo docker compose up -d
   ```

## settings CTFd-Whale
![img](docs/ctfd-whale-admin-settings-docker.png)
![img](docs/ctfd-whale-admin-settings-router.png)

## settings CTFd-Owl
![img](docs/owl-config-1.png)
![img](docs/owl-config-2.png)

## Challenge settings
![img](docs/challenges-new.png)

## Upload docker-compose (Owl)
![img](docs/owl-upload.png)

## Docker operating
![img](docs/docker-1.png)
![img](docs/docker-2.png)

## owl usefull commands
```bash
docker images | grep '^vkactf_user' | awk '{print $3}' | xargs docker rmi -f
```
## delete none
```bash
docker images | grep '<none>' | awk '$1 == "<none>" && $2 == "<none>" {print $3}' | xargs docker rmi
```